<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * Title           Photo class library
 *
 * @package        appworkz
 * Location        application/frontend/libraries/photo
 *
 * @author         Ruwan - ruwanpathmalal@gmail.com
 * @copyright      appworkz
 *
 * created on      28-12-2012, 10:30AM by Ruwan
 * updated on      dd-mm-yyy, hh:mm by {name}
 *
 * Description     Functionalities relavant to photo module
 *
 * */

class Photo
{

    /**
     * CodeIgniter global
     *
     * @var string
     **/
    protected $ci;


    /**
     * __construct
     *
     * @param none
     * @access public
     * @return void
     * @author Ruwan - ruwanpathmalal@gmail.com
     **/
    public function __construct()
    {
        $this->ci =& get_instance();
        $this->ci->load->model('photo/photo_model');
    }


    /**
     * __call
     *
     * Acts as a simple way to call model methods without loads of stupid alias'
     *
     * @param $method
     * @param $arguments
     * @access public
     * @return array
     * @author Ruwan - ruwanpathmalal@gmail.com
     **/
    public function __call($method = NULL, $arguments = NULL)
    {
        if (!method_exists( $this->ci->photo_model, $method) )
        {
            throw new Exception('Undefined method Photo::' . $method . '() called');
        }
        return call_user_func_array( array($this->ci->photo_model, $method), $arguments);
    }

    /**
     * This will add a new photo
     *
     * @param array $data
     * @access public
     * @return int $id
     * @author Ruwan - ruwanpathmalal@gmail.com
     **/
    public function add($data = array()) {
        return $this->ci->photo_model->add($data);
    }

    /**
     * This will add a new photo
     *
     * @param array $data
     * @access public
     * @return int $id
     * @author Ruwan - ruwanpathmalal@gmail.com
     **/
    public function update_business($business_id,$data) {
    	return $this->ci->photo_model->update_business($business_id, $data);
    }
    
    /**
     * get album photos
     *
     * @param int $album_id
     * @param int $limit
     * @param int $offset
     * @access public
     * @return array 
     * @author Ruwan - ruwanpathmalal@gmail.com
     **/
    public function get_album_photos($album_id,$limit=NULL,$offset=NULL) {
    	return $this->ci->photo_model->get_album_photos($album_id,$limit,$offset);
    }
    
    /**
     * mark as delete photo
     *
     * @param int $business_id
     * @param int $album_id
     * @access public
     * @return boolean
     * @author Ruwan - ruwanpathmalal@gmail.com
     **/
    public function delete_album_photo($business_id,$album_id,$photo_id=NULL) {
    	return $this->ci->photo_model->delete_album_photo($business_id, $album_id,$photo_id);
    }
    

}

/* End of file Photo.php */
/* Location: ./application/frontend/libraries/activity/photo/Photo.php */
